import pages from '@/pages'
import useAppStore from '@/store/modules/app'

const AppRouter = () => {
  const { pageConfig } = useAppStore()

  const PageComponent = pages.find((item) => item.page === pageConfig.page)?.component

  return PageComponent ? <PageComponent {...pageConfig.params} /> : null
}

export default AppRouter
